home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 10
/
The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso
/
PC_SIGCD
/
22
/
9
/
DISK2290.ZIP
/
NG_MAKER.DOC
< prev
next >
Wrap
Text File
|
1980-01-01
|
29KB
|
659 lines
Page 1 Automatic Code Documentation
Automatic Source Code Documentation Automatic Source Code Documentation
Copyright Steven W. Kurtz, 1989-90 Copyright Steven W. Kurtz, 1989-90
All rights reserved All rights reserved
Table of contents
Introduction 2
Registration 2
Problems NG_MAKER addresses 2
The NG_MAKER system design 3
What if you don't use make? 4
Modifications to the make file 4
Macros and NG_MAKER 8
Modifications to the project source code 9
Program module descriptions 10
Running NG_MAKER 11
A Note for PC-Browse users 11
Compiling Norton Guides 11
About the author 12
Copyright notice and license 12
Warranty 12
Registration 13
Technical support 13
Version History 13
Page 2 Automatic Code Documentation
INTRODUCTION:_____________
This program is designed to be used in conjunction with the Norton
Guides, published by Peter Norton Computing, and PC-Browse published
by QuickSoft. NG_MAKER will read the ascii source code for any program
and extract the comments which indicate the purpose, function, and
expectations of the various building blocks of your program.
NG_MAKER will combine and assemble these comments into a database file
compatible with the Norton Guides or PC-Browse. Once completed, you
will be free to call up either program and review at a glance the
various building blocks that make up the program you are working on.
REGISTRATION:_____________
Registration (for the paultry sum of $25) will avail you of the latest
version of NG_MAKER and every major upgrade thereafter. If you so
request, I will also send you the latest version of Quicksoft's
excellent PC-Browse program. I am one of the beta testers for this
product.
I am always interested in suggestions for improvement. You may mail
them or send them EMAIL (Via Compuserve at 73577,2271 or via Prodigy
at MDKS67A).
PROBLEMS NG_MAKER ADDRESSES:____________________________
As a the coding of a program develops, it is common (and desirable) to
break the program into smaller files that are written and then linked
together in some fashion. Each file will consist of one or more
"building blocks" - commonly called Subroutines, Procedures, or building blocks
Functions (depending on the language). For the purpose of this manual,
we will simply refer to all of them as "PROCEDURES". PROCEDURES
Which file contains a particular procedure soon becomes more than an
average person can remember. To make programming as easy as possible,
the following information should also be available:
- The line number that the procedure starts at. Most editors have
a feature to jump to a particular line. This is much faster then
having to use the search command to locate the starting point of
a procedure.
- The parameters that a particular procedure expects, what
registers or variables it alters, and other major components it
uses.
Page 3 Automatic Code Documentation
- More than one programmer may be working on the project. It
becomes vital (but more difficult) for one programmer to know
the manner and expectations of a particular piece of code
written by a cohort.
- NG_MAKER can be used by a project manager to keep control on
the revision history for project modules.
THE NG_MAKER SYSTEM DESIGN__________________________
NG_MAKER is designed to work in intimate cooperation with MicroSoft
compatible MAKE files that control the compilation of large projects.
Using NG_MAKER will require that you make small changes in your Make
file and to the source code for your project. In each case, the
changes are all "hidden" behind Remark symbols, so they are completely
invisible to your compiler/assembler.
Refer to the following block diagram in the explanation that follows.
┌──────┐
│ MAKE │ ┌───────────────┐
│ FILE │ ┌────│ Source file #1│
└──────┘ │ └───────────────┘
│ │
│ ╔══════════════════╗ <────┘ ┌───────────────┐
└───────>║ NG_MAKER ║ <─────────│ Source file #2│
╚══════════════════╝ <────┐ └───────────────┘
║ │
║ │ ┌───────────────┐
║ └────│ Source file #n│
╔══════════╩══════════╗ └───────────────┘
V ║
┌─────────────────┐ ║
│ Norton Guide │ ║
│ Compiler │ ║
└─────────────────┘ ║
║ ║
V ║
┌─────────────────┐ ║
│ Norton Guide │ ║
│ Linker │ ║
└─────────────────┘ ║
║ ║
V V
NORTON GUIDE PC-BROWSE
DATABASE FILE
NG_MAKER reads the contents of the Make file. It gains the following
information from that file.
- What symbol the files that follow use to indicate the start of
a remark line.
- What symbol (if any) the files that follow use to indicate the
Page 4 Automatic Code Documentation
end of a remark line.
Page 5 Automatic Code Documentation
- The subdirectory and filename for the output file that will be
used to create the actual database.
- The name of the project. This line is displayed when Options O
Database is selected from the Norton Guide main menu. D
- The list of source code files that are to be analyzed.
- Where, in the list of source code files, a new database element
is to be started (this applies only to Norton Guides).
NG_MAKER will then read each source code file that was mentioned in
the Make file. From each file, it will get the following information:
- A File Summary (optional).
- The name for each procedure.
- The line number that the procedure starts at.
- Comments and remarks, written by you, about how the procedure
works.
- Other pertinent cross references that would help explain how
the procedure works. These will be combined to form a
"See Also:" line.
After all the files have been read, the output file that was specified
in the Make file will be written on the disk.
When using the Norton Guides, a batch file will compile each element
of the database and then link them together to create the final
product. These two steps require the NGC.EXE and NGML.EXE programs
that come with the Norton Guides.
WHAT IF YOU DON'T USE MAKE?___________________________
Don't worry! NG_MAKER does not require that your program development require
system use MAKE. The commands are compatible with MAKE should you do.
If you do not, simply construct a file that contains nothing but the
NG_MAKER keywords.
MODIFICATIONS TO THE MAKE FILE______________________________
A MicroSoft-compatible Make file will use the # symbol as a remark
character. Any text placed behind this symbol will become invisible
to the MAKE program. For this very reason, all NG_MAKER code words
start with the two "#!" symbols. The ! insures that an innocent
comment is not mistakenly interpreted as an NG_MAKER keyword. Here is
Page 6 Automatic Code Documentation
a short and simple file to illustrate how an NG_MAKER compatible Make
file would look. All lines that do not start with #! are lines that
MAKE.EXE would interpret and execute. If you are curious as to how
they work, refer to the appropriate chapter in your manual.
#!NAME: Disk Peek project#!NAME: Disk Peek project
#!OUT: C:\BROWSE\DSKPEEK#!OUT: C:\BROWSE\DSKPEEK
#!REMARK: ;#!REMARK: ;
#!ENDMARK:#!ENDMARK:
#!SOURCE: C:\ASSEMBLR\DP1.ASM#!SOURCE: C:\ASSEMBLR\DP1.ASM
DP1.OBJ: C:\ASSEMBLR\DP1.ASM C:\ASSEMBLR\MACROS.INC C:\ASSEMBLR\DP.EQUDP1.OBJ: C:\ASSEMBLR\DP1.ASM C:\ASSEMBLR\MACROS.INC C:\ASSEMBLR\DP.EQU
MASM C:\ASSEMBLR\DP1.ASM; MASM C:\ASSEMBLR\DP1.ASM;
#!SOURCE: C:\ASSEMBLR\DP2.ASM#!SOURCE: C:\ASSEMBLR\DP2.ASM
DP2.OBJ: C:\ASSEMBLR\DP2.ASM C:\ASSEMBLR\MACROS.INC C:\ASSEMBLR\DP.EQUDP2.OBJ: C:\ASSEMBLR\DP2.ASM C:\ASSEMBLR\MACROS.INC C:\ASSEMBLR\DP.EQU
MASM C:\ASSEMBLR\DP2.ASM; MASM C:\ASSEMBLR\DP2.ASM;
DP.EXE: DP1.OBJ DP2.OBJDP.EXE: DP1.OBJ DP2.OBJ
LINK DP1.OBJ+DP2.OBJ,DP.EXE; LINK DP1.OBJ+DP2.OBJ,DP.EXE;
Notice how the #!SOURCE lines are placed right next to the Make line
that affects the same file. This is not absolutely required, but will
help you later should you ever change or add a filename. The keywords
that you see are explained in detail in the following pages.
#!NAME:#!NAME:
This line will show up when Norton Guides' Options Database list shows O D
the list of databases available. PC-Browse users will find this title
placed at the beginning of their database file. EXAMPLES:
#!NAME: New spreadsheet project
#!NAME: My special word processor
#!OUT:#!OUT:
This command will tell NG_MAKER the name for the output file. The
filename that ends the path should be no longer than 7 characters, and
must not contain an extension. To illustrate, the following lines
would not be valid:
#!OUT: C:\NORGUIDE\MYSAMPLE "MYSAMPLE" is too long.#!OUT: C:\NORGUIDE\MYSAMPLE ________
Page 7 Automatic Code Documentation
#!OUT: C:\NORGUIDE\MYSMPLE.OUT "MYSMPLE.OUT" has an extension.#!OUT: C:\NORGUIDE\MYSMPLE.OUT ___________
For Guide users, it is recommended that the OUT file be directed to
the same directory that holds the Norton Guide program, NGC.EXE and
NGML.EXE.
For Browse users, NG_MAKER will take this file name and append a
".BRS" extension to the end.
#!SOURCE:#!SOURCE:
This is the most important keyword for NG_MAKER. You will have one of
these lines for each source code file NG_MAKER will read. Here are
some examples
#!SOURCE: C:\PROJK\EDITOR.C#!SOURCE: C:\PROJK\EDITOR.C
#!SOURCE: F:INCLUDER.ASM#!SOURCE: F:INCLUDER.ASM
#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.010#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.010
#!REMARK:#!REMARK:
This keyword tells NG_MAKER what the remark character(s) are for the
source code it will examine. The default is a semicolon (the author
of NG_MAKER is an ardent assembly language programmer).
Pascal programmers would include the line:
#!REMARK: { #!REMARK: {
or
#!REMARK: (* #!REMARK: (*
and C programmer would use
#!REMARK: /* #!REMARK: /*
#!ENDMARK:#!ENDMARK:
Some languages have a matching end-remark symbol. For these cases,
include the command
#!ENDMARK: #!ENDMARK:
followed by the appropriate symbol(s) for your language.
In many instances, a project will be written in more than one language
(C and Assembler, for instance). The REMARK and ENDMARK indicators
can be altered any number of times to fit the changing situation.
A note of caution: some languages will never use the ENDMARK keyword
Page 8 Automatic Code Documentation
(Assembler, Quick & TurboBasic). However, you may be switching from a
language that DOES. To avoid complications, make sure you include the
line :
#!ENDMARK: #!ENDMARK:
with nothing after it. The following lines illustrate this concept.
The lines that MAKE.EXE would actually execute have been removed for
clarity.
#!NAME: World's best TSR program#!NAME: World's best TSR program
#!OUT: C:\BROWSE\PROJ-X#!OUT: C:\BROWSE\PROJ-X
#!REMARK: /* <----these two lines set up#!REMARK: /*
#!ENDMARK: */ <----the remarks for the C#!ENDMARK: */
#!SOURCE: C:\MYPROJ\MODULE1.C files that follow.#!SOURCE: C:\MYPROJ\MODULE1.C
#!SOURCE: C:\MYPROJ\MODULE2.C#!SOURCE: C:\MYPROJ\MODULE2.C
#!SOURCE: C:\MYPROJ\MODULE3.C#!SOURCE: C:\MYPROJ\MODULE3.C
#!REMARK: ; <----Some assembler files need#!REMARK: ;
#!ENDMARK: to be read, so switch to#!ENDMARK:
#!SOURCE: C:\MYPROJ\MODULE4.ASM using a semicolon for the#!SOURCE: C:\MYPROJ\MODULE4.ASM
#!SOURCE: C:\MYPROJ\MODULE5.ASM remark character (nothing#!SOURCE: C:\MYPROJ\MODULE5.ASM
#!SOURCE: C:\MYPROJ\MODULE6.ASM for "ENDMARK").#!SOURCE: C:\MYPROJ\MODULE6.ASM
#!REMARK: /*#!REMARK: /*
#!ENDMARK: */ <----back to C. change remark#!ENDMARK: */
#!SOURCE: C:\MYPROJ\MODULE7.C characters again.#!SOURCE: C:\MYPROJ\MODULE7.C
#!BREAK:#!BREAK:
The situation may occur that you have more procedures than the
Norton Guides can hold. It may report that "the list of short entries
is too long" during the compilation process. The final key word
handles this situation. Place it as many times as necessary in the
list of source files like this:
#!NAME: Project SS#!NAME: Project SS
#!OUT: D:\NORGUIDE\SS#!OUT: D:\NORGUIDE\SS
#!REMARK: ;#!REMARK: ;
#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.010#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.010
#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.020#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.020
#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.030#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.030
#!BREAK:#!BREAK:
#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.040#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.040
#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.050#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.050
#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.060#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.060
#!BREAK:#!BREAK:
#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.110#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.110
#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.120#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.120
#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.130#!SOURCE: D:\ASSEMBLR\SS_SRCE\SS.130
This means that procedures in SS.010 through SS.030 will appear in
Page 9 Automatic Code Documentation
Procedure Group A, SS.040 through SS.060 will appear in Procedure
Group B and so on. This will result in the top line of the Norton
Guide looking somewhat like this:
Expand Search... Options By_Group Sorted
────────────────────────────────────┬──────────────────┬────────
│ A Procedure group│
│ B Procedure group│
│ C Procedure group│
└──────────────────┘
It is best that you not use #!BREAK: at all unless the Norton Guide
compiler reports the previously described error message.
#!BREAK: has no affect on PC-Browse databases and can be ignored.
MACROS AND NG_MAKER___________________
In keeping with compatibility with the Make utility, NG_MAKER also
includes macro expansion. This lets you integrate a little
flexibility into the Make control file. Consider the following
fragment from a Make control file.
SRC=C:\ASSEMBLR\SS_SRCE\SRC=C:\ASSEMBLR\SS_SRCE\
. .
. .
. .
#!SOURCE: $(SRC)SS.010#!SOURCE: $(SRC)SS.010
#!SOURCE: $(SRC)SS.020#!SOURCE: $(SRC)SS.020
#!SOURCE: $(SRC)SS.030#!SOURCE: $(SRC)SS.030
In this example, NG_MAKER will substitute every occurrence of "$(SRC)"
with "C:\ASSEMBLR\SS_SRCE\" before working on the line. One can use
this feature to change how the program operates by simply changing one
or two lines in the beginning of the control file.
Page 10 Automatic Code Documentation
MODIFICATIONS TO THE PROJECT SOURCE CODE________________________________________
Now you have to make some changes to the actual source code. This step
has been made as painless as possible. As and example, consider the
following assembly language procedure that prints out a string pointed
to by DS:DX
;============================================================;============================================================
;DICT Print;DICT Print
;;
; Enter with DS:DX pointing to a string ending in a $ symbol.; Enter with DS:DX pointing to a string ending in a $ symbol.
; Before printing, it places the cursor at row/col indicated by; Before printing, it places the cursor at row/col indicated by
; BH and BL; BH and BL
;-------------------------;-------------------------
;CALLS PlaceCursor ColorNormal;CALLS PlaceCursor ColorNormal
;ENDD;ENDD
;============================================================;============================================================
PRINT PROC NEARPRINT PROC NEAR
Call ColorNormal Call ColorNormal
Call PlaceCursor Call PlaceCursor
Mov AH,09 Mov AH,09
Int 21h Int 21h
RET RET
PRINT ENDPPRINT ENDP
For the non-Assembler folks, the same thing in Pascal...
{============================================================}{============================================================}
{DICT Print }{DICT Print }
{{
Syntax is PRINT(Row,Col, stuff_to_Print)Syntax is PRINT(Row,Col, stuff_to_Print)
Places cursor and prints message on screen.Places cursor and prints message on screen.
}}
{------------------- }{------------------- }
{CALLS PlaceCursor ColorNormal }{CALLS PlaceCursor ColorNormal }
{ENDD }{ENDD }
{============================================================}{============================================================}
PROCEDURE PRINT (Row,Col : INTEGER,Stuff : BigString);PROCEDURE PRINT (Row,Col : INTEGER,Stuff : BigString);
BEGINBEGIN
ColorNormal; ColorNormal;
PlaceCursor(Row,Col); PlaceCursor(Row,Col);
Write(Stuff); Write(Stuff);
END;END;
Notice that in both examples, the actual code is preceded by a box
that describes the purpose and expectations of the code block. The
general construction of this block is quite simple ...
<rem> DICT <procedure name> <endrem> DICT
Page 11 Automatic Code Documentation
<Your explanation of the procedure. Can be as long as you want>
<rem> CALLS <an optional list of other procedures that can be cross referenced> CALLS
<rem> ENDD <endrem> ENDD
As mentioned before, the keywords (DICT,CALLS,ENDD) are hidden behind
whatever comment symbol is appropriate for that particular language.
Notice one other thing: I used "====" and "----" bars inside the
comment block to make things a bit easier to read. NG_MAKER will take
these out in the final database file.
That is all the changes that are required for your source code. You
may already have these header blocks in your code. If so, simply add
the DICT and ENDD lines (and CALLS line, if you wish) and you're all
set!
PROGRAM MODULE DESCRIPTIONS___________________________
You may have found that you have grouped procedures of similar purpose
together in the same file. For instance, you may have placed all
procedures that deal with printer I/O in a file called PROG1PRN.ASM.
You can place a description of this module at the beginning of the file at the beginning
to be extracted by NG_MAKER. Its construction is as follows:
<rem> DESC <endrem> DESC
<Your explanation of the group of procedures.
<can be any number of lines long>
<rem> ENDD <endrem> ENDD
To illustrate, examine the following fragment from the start of a file
called MEGAPROJ.ASM
;DESC;DESC
;;
;The procedures in this file are responsible for the following:;The procedures in this file are responsible for the following:
;;
;1) Receive line input from the user.;1) Receive line input from the user.
;2) Handles DOS Critical Errors;2) Handles DOS Critical Errors
;3) Screen save and restore primatives.;3) Screen save and restore primatives.
;;
;;
; Note : A reminder to J.F. He has to make the screen saver routines; Note : A reminder to J.F. He has to make the screen saver routines
; faster. Too much snow on old CGA systems.; faster. Too much snow on old CGA systems.
;;
;ENDD;ENDD
Page 12 Automatic Code Documentation
See how the program director has used this feature to summarize the
jobs that are handled by this file. He also added some project
management notes.
Sometimes a particular part of your program may involve a rather
complex logic strategy. I have found it very useful to describe this
strategy in the DESC area of the file. Later when I have to re-work
the section of code, I can review this explanation.
Norton Guide users will see these descriptions when they select the "BY
FILE" option in the "SORTED" menu. This will then display a listing of the
files. Hilite a filename and press ENTER. The DESCription will be shown
under "FILE SUMMARY" followed by a list of procedures contained in
that file.
PC-BROWSE users will find this information indexed under "FILE SUMMARY"
which is at the bottom of the list of alphabetized procedures. Use
Shift-PgDn to move down to it easier. Use the arrow keys to hilite "FILE
SUMMARY" and press ENTER.
RUNNING NG_MAKER________________
To start NG_MAKER on its way to extracting the comments from your
source code, simply type NG_MAKER followed by the name of the Make
control file. If you wish to extract into a file compatible with PC-
Browse, end the line with a /BR. Here are some examples :
NG_MAKER D:\ASSEMBLR\DT_SRCE\DTREENG_MAKER D:\ASSEMBLR\DT_SRCE\DTREE
This uses the make file, DTREE and creates a series of files
compatible with Norton Guides.
NG_MAKER D:\ASSEMBLR\DL_OBJS\DLINK /BRNG_MAKER D:\ASSEMBLR\DL_OBJS\DLINK /BR
This uses the make file, DLINK and creates a file compatible with PC-
Browse.
A NOTE FOR PC-BROWSE USERS__________________________
You lesson stops here! The final file is completely PC-Browse
compatible and can be used immediately.
COMPILING NORTON GUIDE______________________
Norton Guide users must complete one final step which is the
compilation and linking of the files created with NG_MAKER.
Fortunately, a simple batch file called QNG.BAT does it all. You will
Page 13 Automatic Code Documentation
find this file included on your NG_MAKER disk. Copy it to the
subdirectory containing the NGC.EXE and NGML.EXE programs from your
Norton Guide disk.
To run the batch file, simply enter QNG followed by the name of the
file specified in the #!OUT: line of the make file you just used. For
example, if you Make file contained the line:
#!OUT: C:\NORGUIDE\PROJX#!OUT: C:\NORGUIDE\PROJX
Run the batch file as QNG C:\NORGUIDE\PROJX QNG C:\NORGUIDE\PROJX
or simply QNG PROJX if you told the Make file to create QNG PROJX
PROJX in the same directory that holds QNG.BAT, NGC.EXE and NGML.EXE.
Page 14 Automatic Code Documentation
ABOUT THE AUTHOR________________
Steven Kurtz is the author of the hard disk manager, Direc-Tree and
Direc-Link, a file transfer utility program. Both programs are
published by the Micro-Z Company. A new program, Del/Elite is still
looking for a publisher at this time.
COPYRIGHT NOTICE AND LICENSE____________________________
Steven W. Kurtz, the copyright owner for NG_MAKER, hereby licenses you
to: use the software; make as many copies of the shareware version of
this software and documentation as you wish; give exact copies of the
original shareware version to anyone; and distribute the shareware
version of the software and documentation in its unmodified form via
electronic means. There is no charge for any of the above.
This is not free software. This license allows you to use this software
without charge for a period of 30 days. In order to include this
software as part of any product, either commercial, shareware,
freeware, or public domain, registration is required. Any such use of
NG_MAKER is in violation of federal copyright laws and will be
prosecuted.
No copy of the software may be distributed or given away without this
accompanying documentation; this notice must not be removed. ONLY
COPIES OF THE SHAREWARE VERSION MAY BE DISTRIBUTED IN ANY FORM.
WARRANTY________
There is no warranty of any kind associated with this software, and
the copyright owner is not liable for damages of any kind. By using
this software, you agree to this. Every effort has been made by me to
make this product bug-free. However, the nature of software
development is that it is impossible to guarantee bug-free software. If a
registered user reports a verifiable bug, the user will receive a free
upgrade to the next version of NG_MAKER.
REGISTRATION____________
Upon receipt of the appropriate registration fee, I will send the user a
printed copy of this documentation, and a disk containing the latest
version of NG_MAKER.
Page 15 Automatic Code Documentation
TECHNICAL SUPPORT_________________
Questions regarding NG_MAKER are given to registered users via
Compuserve or Prodigy Electronic mail
Steven W. Kurtz
1433 Summerland Ave.
San Pedro, CA 90732
Compuserve 73577,2271
Prodigy MDKS67A
VERSION HISTORY_______________
1.0 First release
2.0 Add sorting
Support for PC-Browse
2.1 - 2.4 Internal use by me
2.5 Released to public
2.6 Fix problem with ENDMARKs
2.7 Added DESC feature
Sort gets it own menu in Norton Guides